#!/usr/bin/perl # for syntax checking...
{
	my $portal_count=undef;
	my $user_count=undef;
	my $report_count=undef;

sub mm_gri_stat_info {
my $type=shift;

	if(!defined($portal_count)) {
		my $plist=$::GRI_FRONTEND->get_portal_list();

		my %U=(); my %R=();
		for my $cportal (@$plist) {
			my $mm2=$::GRI_FRONTEND->get_portal_report_names($cportal);
			my @FF;
			if(!ref($mm2)) {
				@FF=split(/,/,$mm2);
			} else {
				@FF=@$mm2;
			}
			for my $cr (@FF) {
				$R{$cr}=1;
			}
			my $mm=$::GRI_FRONTEND->get_portal_users($cportal);
			for my $cu (@$mm) {
				$U{$cu}=1;
			}
		}
		$portal_count=@$plist;
		$user_count=keys(%U);
		$report_count=keys(%R);
	}

	if(!defined($type)) {
		return "Portals: $portal_count, Reports: $report_count, Users: $user_count";
	}
	return($portal_count) if $type eq "portals";
	return($user_count) if $type eq "users";
	return($report_count) if $type eq "reports";
	return "";
}

}
